<?

// picks sensor 2 only

include_once ('phpMyGraph5.0.php'); // Link to library file phpMyGraph 5.0

     $cfg ['title'] = 'Sensor 2'; 	//Configure, title, width and height
     $cfg ['width'] = 1250;		//number of pixels horizontally
     $cfg ['height'] = 500;		//number of pixels vertically
	 $cfg ['title-color'] = '#000000';
	 $cfg ['background-color'] = '#cccecf';
	 $cfg ['average-line-color'] = '#000000';

include "conninfo.php";  
$query="SELECT * FROM rainfalldata WHERE sensor=1 order by thedate";
$result=mysqli_query($link,$query);		//get data from database

$data=array();
$x=0;
while ($r = mysqli_fetch_array($result))
{
$dt=$r["thedate"];
$dt=strtotime($dt);
$dt=date("d-M-y H:i",$dt);
$data[$dt] = $r["mydata"];			//put data into array
}

header ("Content-type: image/png"); 
$graph = new phpMyGraph();
$graph-> parseVerticalColumnGraph ($data, $cfg); //create graph
?>
